﻿package mortal.game.view.fashionOnline
{
    import com.gengine.resource.*;
    import com.mui.events.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.geom.*;
    import flash.utils.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;
    import mortal.game.manager.window3d.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.fashionOnline.view.*;
    import mortal.game.view.wizard.*;
    import mortal.mvc.interfaces.*;

    public class FashionOnlineModule extends BaseWindow
    {
        private var _tabBar:GTabarNew;
        private var _pageTabData:Array;
        private var _dicIndexClass:Dictionary;
        private var _currentPanel:FashionOnlinePanelBase;
        private var _rect3d:Rect3DObject;

        public function FashionOnlineModule(param1:ILayer = null)
        {
            this._dicIndexClass = new Dictionary();
            this.initTabData();
            super(param1);
            setSize(890, (587 + 1));
            title = Language.getString(21475);
            this.layer = LayerManager.windowLayer3D;
            return;
        }// end function

        private function initTabData() : void
        {
            this._pageTabData = Language.getArray(40600);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._tabBar = UIFactory.gTabBarNew(3, 30, this._pageTabData, 887, 587 + 3, 62, 22, this, this.onTabBarChange, "TabButtonNew");
            this._tabBar.selectedIndex = 0;
            this.init3dRect();
            this._dicIndexClass[0] = FashionOnlineDisplayPanel;
            LoaderHelp.addResCallBack(ResFileConst.fashionOnline, this.onResLoadCompl);
            return;
        }// end function

        private function init3dRect() : void
        {
            this._rect3d = Rect3DManager.instance.registerWindow(true, new Rectangle(11, 59, 877, 531), this);
            Rect3DManager.instance.windowShowHander(null, this);
            return;
        }// end function

        private function onResLoadCompl() : void
        {
            if (isDisposed)
            {
                return;
            }
            this.onTabBarChange();
            return;
        }// end function

        private function onTabBarChange(event:MuiEvent = null) : void
        {
            var _loc_2:* = UICompomentPool.getUICompoment(this._dicIndexClass[this._tabBar.selectedIndex], this);
            if (_loc_2 != this._currentPanel)
            {
                if (this._currentPanel && !this._currentPanel.isDisposed)
                {
                    this._currentPanel.dispose();
                }
                this.contentTopOf3DSprite.addChild(_loc_2);
                _loc_2.x = 11;
                _loc_2.y = 59;
                this._currentPanel = _loc_2;
            }
            return;
        }// end function

        public function get rect3d() : Rect3DObject
        {
            return this._rect3d;
        }// end function

        public function set rect3d(param1:Rect3DObject) : void
        {
            this._rect3d = param1;
            return;
        }// end function

        public function get currentPanel() : FashionOnlinePanelBase
        {
            return this._currentPanel;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._tabBar.dispose(param1);
            this._currentPanel.dispose(param1);
            this._tabBar = null;
            this._currentPanel = null;
            if (this._rect3d)
            {
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
            }
            return;
        }// end function

    }
}
